﻿//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Data;
//using System.Drawing;
//using System.Linq;
//using System.Text;
//using System.Windows.Forms;

//namespace Exdot
//{
//    public partial class FormTimKiem : Form
//    {
//        public FormTimKiem()
//        {
//            InitializeComponent();
//        }

//        private void FormTimKiem_Load(object sender, EventArgs e)
//        {
//            // TODO: This line of code loads data into the 'quanLyChiTieuDataSet.ChiTieu' table. You can move, or remove it, as needed.
//            this.chiTieuTableAdapter.Fill(this.quanLyChiTieuDataSet.ChiTieu);

//        }

       
//    }
//}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Exdot
{
    public partial class FormTimKiem : Form
    {
        public List<ChiTieu> result = null;
        public FormTimKiem()
        {
            InitializeComponent();
        }
        private void bntTim_Click(object sender, EventArgs e)
        {
            if (cbTenCT.Text == "")
            {
                MessageBox.Show("Nhap tu khoa can tim");
            }
            else
            {
                using (var context = new QuanLyChiTieuEntities())
                {
                    result = ((from a in context.ChiTieux where a.TenChiTieu.Contains(cbTenCT.Text) && a.ThoiGian >= (dtpNgay.Value) select a).ToList<ChiTieu>());
                }
                this.Close();
            }
        }

        private void FormTimKiem_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'quanLyChiTieuDataSet.ChiTieu' table. You can move, or remove it, as needed.
            this.chiTieuTableAdapter.Fill(this.quanLyChiTieuDataSet.ChiTieu);
            // TODO: This line of code loads data into the 'quanLyChiTieuDataSet.ChiTieu' table. You can move, or remove it, as needed.
            // TODO: This line of code loads data into the 'quanLyChiTieuDataSet.ChiTieu' table. You can move, or remove it, as needed.
            // TODO: This line of code loads data into the 'quanLyChiTieuDataSet3.ChiTieu' table. You can move, or remove it, as needed.
          

        }

        private void bntTim_Click_1(object sender, EventArgs e)
        {
            if (cbTenCT.Text == "")
            {
                MessageBox.Show("Nhap tu khoa can tim");
            }
            else
            {
                using (var context = new QuanLyChiTieuEntities())
                {
                    result = ((from a in context.ChiTieux where a.TenChiTieu.Contains(cbTenCT.Text) && a.ThoiGian.Year == dtpNgay.Value.Year && a.ThoiGian.Month == dtpNgay.Value.Month && a.ThoiGian.Day == dtpNgay.Value.Day select a).ToList<ChiTieu>());
                }
                this.Close();
            }
        }

        private void dtpNgay_ValueChanged(object sender, EventArgs e)
        {

        }



    }
}
